﻿using Application.Users.Queries.GetUser;
using Application.Validators;
using FluentValidation;
using MediatR;
using Microsoft.Extensions.DependencyInjection;

namespace Application
{
    public static class ApplicationCollectionExtensions
    {
        public static IServiceCollection AddMediatRService(this IServiceCollection services)
        {
            services.AddMediatR(cfg =>
            {
                cfg.RegisterServicesFromAssembly(typeof(UserLoginHandler).Assembly);
            });

            services.AddValidatorsFromAssembly(typeof(UserLoginHandler).Assembly);
            return services;
        }
    }
}
